package me.yushuai.wukong.base.entity;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Objects;

/**
 * 全局配置
 *
 * @author zhoushuai@189.cn
 * @since 2023-04-17
 */
@Setter
@Getter
@Entity
@ToString
@Table(name = "BASE_CONF_GLOBAL")
public class GlobalConf {

    /**
     * 配置的定义信息
     */
    @Id
    @Column(name = "conf_def_id")
    private Long defId;

    /**
     * 配置的值
     */
    @Column(name = "value1")
    private String value;

    /**
     * 为兼容两个值数据
     */
    @Column(name = "value2")
    private String value2;

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        GlobalConf that = (GlobalConf) o;
        return Objects.equals(getDefId(), that.getDefId()) && Objects.equals(getValue(), that.getValue()) && Objects.equals(getValue2(), that.getValue2());
    }

    @Override
    public int hashCode() {
        return Objects.hash(getDefId(), getValue(), getValue2());
    }
}
